package com.ziyun.pop.modules.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.service.order.constant.OrderResult;
import com.service.order.model.erp.AllotOrderResultDto;
import com.service.order.model.erp.ErpAllotFactoryOrderParamDto;
import com.service.order.model.order.OrderMessageParamDto;
import com.ziyun.pop.modules.erpOrderLog.entity.ErpOrderLogEntity;
import com.ziyun.pop.modules.logistics.dto.ErpLogisticsDto;
import com.ziyun.pop.modules.order.dto.*;
import com.ziyun.pop.modules.order.entity.ErpOrderEntity;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.sys.entity.SysUserEntity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * erp订单信息表
 *
 * @author gaosheng
 * @date 2018-09-26 12:00:00
 */
public interface ErpOrderService extends IService<ErpOrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    PageUtils queryPageErpOrderList(Map<String,Object> params);

    List<String> querySalesManList(Long sellerId);

    List<String> queryRegionsSascade();

    boolean updateByMap(Map<String,Object> upMap, String orderNo);

    /**
     * 分页查询
     * @param params
     * @return
     */
    R queryPageMonthlyOrderList(Map<String, Object> params);

    R getErpOrderInfo(String orderNo);

    /**
     * 确认收款页面
     * @param orderNos
     * @return
     */
    R collectMoneyPage(String[] orderNos);

   R  saveErpOrderWithItem(ErpOrderItemDto erpOrderItemDto);


    R getOrderPayInfo(String orderNos);

    /**
     * 订单号查询ERP订单信息
     * @param orderId
     * @return
     */
    ErpOrderEntity selectByOrderId(Long orderId);

    /**
     * 月结订单收款
     * @param monthlyOrderPayDto
     * @return
     */
    R monthlyOrderPay(MonthlyOrderPayDto monthlyOrderPayDto);

    /**
     * 取消订单
     * @param erpOrderLogs
     * @return
     */
    R cancelOrder(ErpOrderLogEntity erpOrderLogs);

    R saveErpOrderLogistics(ErpLogisticsDto erpLogisticsDto);

    R saveReceviceMoneyData(Map<String,Object> params);

    R saveBatchReceviceMoney(Map<String,Object> params);

    /**
     * 修改订单优惠以及项目名称
     * @param erpOrder
     * @return
     */
    R updatePmtGoodsAndProjectName(ErpOrderEntity erpOrder);

    R beginOrderPay(Map<String,Object> params);

    /**
     * 结算单微信扫码支付后回调
     * @param request
     * @param response
     * @return
     */
    Boolean orderPayWeixinCallBack(HttpServletRequest request);


    /**
     *扫码收银
     * @param
     * @return
     */
    void receiveMoneyByCode(Map<String,Object> params);

    /**
     *批量扫码收银
     * @param
     * @return
     */
    void bacthReceiveMoneyByCode(Map<String,Object> params);

    R updateByOrderNo(ErpOrderItemDto erpOrderItemDto);

    R updatePayType(ErpOrderEntity erpOrder);

    R orderRecall(String orderNo);

    R orderUrgent(String orderNo);

    R updateStatus(String orderNo, Integer status);

    R finishOrderItem(String orderNo);

    R getErpOrderLog(String orderNo);

    R orderItemAllotFindFactory(Integer eoItemId);

    R quoteOrderItemAllotFindFactory(Integer eoItemId);

    R allotOrderItem(OrderItemAllotDto orderItemAllotDto);

    R orderCraftsInfo(Integer erpItemId);

    R orderCraftAllotFindFactory(OrderCraftQuoteDto orderCraftQuoteDto);

    /**
     * 订单工艺分配
     * @param orderCraftsDto
     * @return
     */
    R allotOrderCrafts(OrderCraftsDto orderCraftsDto);

    /**
     * 删除分配信息
     * @param productionId
     * @return
     */
    R deleteAllotItem(Integer productionId);

    /**
     * 取消订单分配
     * @param orderNo
     * @return
     */
    boolean cancelOrderAllotInfo(String orderNo);

    /**
     * 订单分配下单API调用
     * @return
     */
    OrderResult<AllotOrderResultDto> orderAllotApi(ErpAllotFactoryOrderParamDto erpAllotFactoryOrderParamDto);

    /**
     *
     * @param orderSupplierDto
     * @param userId
     * @return
     */
    R suppSave(OrderSupplierDto orderSupplierDto, Long userId);

    /**
     *
     * @param eoItemId
     * @return
     */
    boolean copyToOrderInfo(Integer eoItemId);

    boolean copyQuoteToOrderInfo(Integer eoItemId);
    /**
     *调价
     * @param
     * @return
     */
    R updateDiscount(ErpOrderEntity erpOrder);

    R deleteGoods(Integer eoItemId);

    R addFastGoods(ErpOrderItemDto erpOrderItemDto);

    R addPrintGoods(ErpOrderItemDto erpOrderItemDto);

    R addStandardGoods(ErpOrderItemDto erpOrderItemDto);

    //查询订单带预存款
    ErpOrderEntity getErpOrder(String orderNo);

    R ziyunOrderBack(String orderNo);

   R startUpdatePrice(ErpOrderItemDto erpOrderItemDto);


   Boolean isErpOrder(String orderNo);

    R confirmCost(String orderNo);

    /**
     * 批量录入成本完成
      * @param ids
     * @param createName
     * @param createBy
     * @return
     */
    R batchEnter(String ids, String createName, String createBy);
    /**
     * 图文宝订单，同时进行统计
     * @param
     * @return
     */
    R queryPageTwbOrderList(Map<String,Object> params);

    R querySearchProduct(Map<String,Object> params);
    /**
     * 图文宝订单新增时，相关参数
     * @param
     * @return
     */
    R addData(Long sellerId,String userName);
    /**
     * 图文宝订单,查询会员
     * @param
     * @return
     */
    R searchMember(Map<String,Object> params);
    /**
     * 图文宝添加订单
     * @param
     * @return
     */
    R saveTwbOrder(ErpOrderItemDto erpOrderItemDto);

    /**
     * 图文宝添加供应商!
     * @param orderSupplierDto
     * @param userId
     * @return
     * */
    R twbSuppSave(OrderSupplierDto orderSupplierDto, Long userId);

    /**
     * 图文宝订单详情页删除供应商分配信息;
     * @param productionId
     * @return
     */
    R twbdeleteAllotItem(Integer productionId);
  /**
   * 图文宝订单信息
   * @param
   * @return
   */
    R twbOrderInfo(String orderNo);
   /**
    * 图文宝订单批量审核（生产状态 待审核变为生产中）
    * @param
    * @return
    */
    R batchAudit(String auditName, String orderNos,String createBy);
    /**
     * 图文宝订单生产完成（生产状态 ->生产完成）
     * @param
     * @return
     */
    R finishTwbOrder(String createName, String orderNos, String createBy);
    /**
     * 图文宝订单取消（生产状态 ->已作废）
     * @param
     * @return
     */
     R cancelTwbOrder(ErpOrderLogEntity erpOrderLogs);
   /**
    * 图文宝收银前订单相关信息
    * @param
    * @return
    */
    R getTwbReceviceMoneyData(String orderNo);
   /**
    * 图文宝收银操作（生产状态 ->已完结）
    * @param
    * @return
    */
    R saveTwbReceviceMoneyData(Map<String,Object> params);
   /**
    * 图文宝添加物流查询相关信息
    * @param
    * @return
    */
    R twbLogisticInfo(String orderNo,Long sellerId);
   /**
    * 图文宝订单修改查询相关信息
    * @param
    * @return
   */
    R twbUpdateOrderInfo(String orderNo);
    /**
     * 图文宝订单修改
     * @param
     * @return
     */
    R updateTwbOrder(ErpOrderItemDto erpOrderItemDto);
   /**
    * 图文宝查询月结订单列表
    * @param
    * @return
    */
    R queryMonthTwbOrderList(Map<String,Object> params);
   /**
    * 图文宝月结订单收银前查询相关信息
    * @param
    * @return
    */
    R getTwbMonthMoneyData(String orderNos);
  /**
   * 图文宝月结订单收银
   * @param
   * @return
   */
    R saveTwbMonthMoney(Map<String,Object> params);
  /**
   * 图文宝小程序查询订单列表
   * @param
   * @return
   */
    R queryPageForTwbOrderList(TwbOrderParamDto twbOrderParamDto);
    /**
     * 图文宝小程序获取订单信息
     * @param
     * @return
     */
    R getTwbOrderInfo(String orderNo);
    /**
     * 图文宝小程序根据订单号进行审核
     * @param
     * @return
     */
    R audit(String orderNo,SysUserEntity sysUserEntity);
    /**
     * 图文宝小程序根据订单号进行生产完成
     * @param
     * @return
     */
    R productFinish(String orderNo, SysUserEntity curentUser);

    R sweepCodeBegin(Map<String, Object> params);

    R batchSweepCodeBegin(Map<String, Object> params);

    R sweepCodeCallBack(Map<String, Object> params);

    R getOrderMessage(OrderMessageParamDto orderMessageParamDto, Long mallUserId);


    R getErpOrderInfoForPay(String orderNo);

    R generateBatchProduct(List<String> orderList);

    R getBatchReceviceMoneyData(List<String> orderNoList);

    R batchSweepCodeCallBack(Map<String, Object> params);
}

